{% load crispy_forms_tags %}
{% block content %}

<div class="row my-4">
    <div class="col-md-12">
        <div class="card">
            <div class="card-header bg-info text-white">
                订单列表
            </div>
            <div class="card-body">
        <form method="POST" class="uniForm" action="">
            {% csrf_token %}
            {{form|crispy}}
            <input class="btn btn-info" type="submit" value="添加订单">
        </form>
    </div>
            <div class="card-body">
                <table class="table bg-white">
                    <thead class="bg-info text-white">
                    <tr>
                        <th scope="col">职员</th>
                        <th scope="col">商品名称</th>
                        <th scope="col">商品类型</th>
                        <th scope="col">订单数量</th>
                        <!-- 可以添加更多列，如订单日期、客户等 -->
                    </tr>
                    </thead>
                    <tbody>
                    {% for order in orders %}
                    {% if order.staff == user%}
                    <tr>
<!--                        <td>{{ order.staff.username }}</td>-->
                        <td>{{ order.product.name }}</td>
                        <td>{{ order.product.get_category_display }}</td>
                        <td>{{ order.order_quantity }}</td>
                        <!-- 这里可以添加操作列，如查看、编辑、删除按钮 -->
                        <th scope="row">

                    <a class="btn btn-danger btn-sm"
                       href="{% url 'dashboard-product-delete' order.id %}">删除</a></th>
                    </tr>
                    {% endif %}
                    {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
{% endblock %}